import blackboxprotobuf
# import requests
#
# headers = {
#     ":authority": "live.douyin.com",
#     ":method": "GET",
#     ":path": "/webcast/im/fetch/?version_code=180800&resp_content_type=protobuf&did_rule=3&device_id=&device_platform=web&cookie_enabled=true&screen_width=1920&screen_height=1080&browser_language=zh-CN&browser_platform=Win32&browser_name=Mozilla&browser_version=5.0%20(Windows%20NT%2010.0;%20Win64;%20x64)%20AppleWebKit/537.36%20(KHTML,%20like%20Gecko)%20Chrome/110.0.0.0%20Safari/537.36&browser_online=true&tz_name=Asia/Shanghai&aid=6383&live_id=1&app_name=douyin_web&debug=false&endpoint=live_pc&support_wrds=1&user_unique_id=&identity=audience&room_id=7200529080507206459&last_rtt=0&fetch_rule=1&cursor=&internal_ext=&msToken=IliMknOt2rFqjlNq201jSoaZmd988_n2jY-H9Fu1C4HdfOm9zx-R9rM4G6SPsNTRohIj0pts_8qW-31aSdRi7Sw1D2oeR0t6IUB6BfJ0T7Szlrhsbf_bDct6YCjCQAI=&X-Bogus=DFSzswVOypsANriSShb/BRXAIQ2g&_signature=_02B4Z6wo00001WAL2gQAAIDAAwEabqyiDT1gC96AADvzLkeCLyXeNcDR4cAC-cEKC4macxZTMpZ-vVfBU6PLJq7XxoQF0TgmcxZqYXOkrRin7M7ZLrID6ZgeKcqHgIu5X.YswZJGz1FqOWSm16",
#     ":scheme": "https",
#     "accept": "*/*",
#     "accept-encoding": 'gzip, deflate, br',
#     "accept-language": 'zh-CN,zh;q=0.9,en;q=0.8',
#     "cache-control": 'no-cache',
#     "content-type": 'application/x-www-form-urlencoded; charset=UTF-8',
#     "cookie": "ttwid=1%7C0mqytvkvD4F6t5jxqMMrKnwlahty5Pi0yI_QOcnKe_w%7C1676446486%7C7b89b4f00ee4ac4b4b437e6d0269b7a0b21667c450b7136f7d5e62c3f06b5577; passport_csrf_token=2bb9fc741bf4c951a3cda6c3c0ea2beb; passport_csrf_token_default=2bb9fc741bf4c951a3cda6c3c0ea2beb; VIDEO_FILTER_MEMO_SELECT=%7B%22expireTime%22%3A1677051287289%2C%22type%22%3A1%7D; strategyABtestKey=%221676446487.571%22; csrf_session_id=510e71220b079a9f08d9c3c3dfd07a36; xgplayer_user_id=297593376873; ttcid=6b1585c119bf4520b5e8d4514b33ef9219; odin_tt=dd1827fa66900156be79f3298b56f9bac6c3dc93b41fc860d9642e2ae7a496f1dbbd0240605ea62905d277f9869ce1754132a7fbfc22a9101c6aca8c7cf0b4aa3baa1e48d3a25ecc4e922820cbe6d77b; download_guide=%223%2F20230215%22; SEARCH_RESULT_LIST_TYPE=%22single%22; home_can_add_dy_2_desktop=%221%22; s_v_web_id=verify_le6f7fsf_aQjGtJ96_KiTE_4D3z_9Iwv_seUEWjjrV1XN; __ac_nonce=063ed8a3400633785636e; __ac_signature=_02B4Z6wo00f01ec.90AAAIDAhDU3KrK8usXnH.PAABokIfATxYMvq1.VMOTNKFEmCfSPi6ghCzJzAI6Jlt2ji565FkfXo.gZCbYcMWLtT-JGkLTgsFqOx6DB6O18lvhw0Bi9RxTuiwyJelnjbe; xgplayer_device_id=19132774025; live_can_add_dy_2_desktop=%221%22; tt_scid=hmc9JBOUUI23EiweByvGMMOTNLvcvy1ivyfVwc9Hv4apNXSizmZi72fmnXrEWnK78a17; msToken=SIky71rDMP9opFdyQc4JhzUGDb4WWZlny0-W5i8uqGaLq83cTSOwJssQQHsYrYDBXlnAjjZ4D1PA4gXoZqnAx7bNdegYxxZ8znA_Es7NViaSGXZ85sIrG4q64Yq3xYA=; msToken=gjyhefJsZRyTHW5i7DRWeDYVFGp9NgLfK8x96gOFV5n_K564_PnzB32EG8ykP97CjuAx9_T29VW712QR0yApWoJJEcSfUS8hhZjnPd4S0RzxWPUwC7Ud1KUtNlPdf6E=",
#     "pragma": "no-cache",
#     "referer": "https://live.douyin.com/400924453668",
#     "sec-ch-ua": '"Chromium";v="110", "Not A(Brand";v="24", "Google Chrome";v="110"',
#     "sec-ch-ua-mobile": '?0',
#     "sec-ch-ua-platform": "Windows",
#     "sec-fetch-dest": 'empty',
#     "sec-fetch-mode": 'cors',
#     "sec-fetch-site": 'same-origin',
#     "user-agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36'
# }
# response = requests.get(
#     "https://live.douyin.com/webcast/im/fetch/?version_code=180800&resp_content_type=protobuf&did_rule=3&device_id=&device_platform=web&cookie_enabled=true&screen_width=1920&screen_height=1080&browser_language=zh-CN&browser_platform=Win32&browser_name=Mozilla&browser_version=5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36&browser_online=true&tz_name=Asia/Shanghai&aid=6383&live_id=1&app_name=douyin_web&debug=false&endpoint=live_pc&support_wrds=1&user_unique_id=&identity=audience&room_id=7200529080507206459&last_rtt=0&fetch_rule=1&cursor=&internal_ext=&msToken=IliMknOt2rFqjlNq201jSoaZmd988_n2jY-H9Fu1C4HdfOm9zx-R9rM4G6SPsNTRohIj0pts_8qW-31aSdRi7Sw1D2oeR0t6IUB6BfJ0T7Szlrhsbf_bDct6YCjCQAI=&X-Bogus=DFSzswVOypsANriSShb/BRXAIQ2g&_signature=_02B4Z6wo00001WAL2gQAAIDAAwEabqyiDT1gC96AADvzLkeCLyXeNcDR4cAC-cEKC4macxZTMpZ-vVfBU6PLJq7XxoQF0TgmcxZqYXOkrRin7M7ZLrID6ZgeKcqHgIu5X.YswZJGz1FqOWSm16"
#     , headers)
# print(response.content)

import base64
data = 'CDQQqYKEi9mdjd9ZGLhFIAgqFQoNY29tcHJlc3NfdHlwZRIEZ3ppcCq5AgoPaW0taW50ZXJuYWxfZXh0EqUCaW50ZXJuYWxfc3JjOnB1c2hzZXJ2ZXJ8d3NzX3B1c2hfcm9vbV9pZDo3MjAwNTI5MDgwNTA3MjA2NDU5fHdzc19wdXNoX2RpZDo3MjAwMjgyNzY5NDAxOTg4NjQ2fHdzc19wdXNoX2xvZ19pZDo2NDY2NjY0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CBLCWFAQwkgPc7w+yPF635pVRrIsyILCi6KCZTtscti3VOM/ceXuxRx6ZYqKrSY0ZSR0xzaD6UGnzyF2htiHhhxHX31dS3ssHCygCRpSkYQUAcmipBUHhWPhIM8rGtIUjFUBC1gVitaEFV1FkEVZlmURI01DvCwIqqIWxkSIa/bpSSf4QHjF6SUtSSequyNpErQPDdlhR49nnOD6YdxlWckuIxVfP443WOOxImIk8ApS9fuG7nMN19k8VpAUUeQlTRGVL3y8HfwbAAD//wEAAP//6IWI9LogAAA='

deserialize_data, message_type = blackboxprotobuf.decode_message(base64.b64decode(data))
print(f"原始数据: {deserialize_data}")
print(f"消息类型: {message_type}")
